package week03;

import java.util.Scanner;

 public class Person {
	private String name;
	private int age;
	private boolean gender;
	private int id;
	public static int j=0;
	
	public Person(){
		System.out.println("This is constructor");
		System.out.printf("%s,%d,%s,%d%n", name,age,gender,j-1);
	}
	
	public Person(String name,int age,boolean gender) {
		this.name = name;
		this.age = age;
		this.gender=gender;
	}
	
	public void setName(String name){
		this.name = name;
	}
	
	public String getName(){
		return name;
	}
	
	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public boolean isGender() {
		return gender;
	}

	public void setGender(boolean gender) {
		this.gender = gender;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String toString(){
		return String.format("Person [name=%s, age=%d, gender=%s, id=%d]", name,age,gender,id);
	}
    
	static
	{
		System.out.println("This is static initialization block");
	}
	{
		System.out.printf("This is initialization block, id is "+j+"\n");
		j++;
	}
 

	public static void main(String[] args) {
		 Scanner in=new Scanner(System.in);
		 int n=Integer.parseInt(in.nextLine());
		 Person[] person=new Person[n];
		 for (int i = 0; i < person.length; i++) {
			Person persons=new Person(in.next(),in.nextInt(),in.nextBoolean());
			person[i]=persons;
			person[i].id=j-1;
		 }
		 for (int i = person.length-1; i>=0;i--) {
			 System.out.println(person[i]);
		 }
		 System.out.println(new Person());
		 in.close();
		}
 }
 